package com.luoluo.service.impl;

import com.luoluo.dao.UserLeaveWordMapper;
import com.luoluo.dao.UserTableMapper;
import com.luoluo.pojo.UserLeaveWord;
import com.luoluo.pojo.UserTable;
import com.luoluo.service.UserTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserTableServiceImpl implements UserTableService {

    @Autowired
    UserTableMapper userTableMapper;
    @Autowired
    UserLeaveWordMapper userLeaveWordMapper;
    @Override
    public UserTable selectByLeaveWordId(Integer id) {
        //先查询中间表，找到留言对应的用户id，再使用用户id查询用户表
//        UserLeaveWord userLeaveWord = userLeaveWordMapper.selectByLeaveWordId(id);

        return userTableMapper.selectByPrimaryKey(1/*userLeaveWord.getUserId()*/);
    }

    @Override
    public List<UserLeaveWord> selectAll() {
        return userLeaveWordMapper.selectAll();
    }

    @Override
    public UserTable selectByUserId(Integer id) {
        return userTableMapper.selectByPrimaryKey(id);
    }
}